<?php


require('./config.php');
require('./func_database.php');
require('./func_player.php');
require('./func_profile.php');

$dbh = initConnection();

$player = new player();
$profile = new profile();

$query ="SELECT *
		   FROM profile
		  ORDER by last_updated
		  LIMIT 0,1
				";

$all_players = selectMultiQuery($query, $dbh);
			


$player_name =  $all_players[0]['name'];

$last_updated = $profile->checkForUpdate($all_players[0]['player_id']);	

$last_updated_time = strtotime(str_replace("-","/",$last_updated));

$current_time = time();

$time_difference = ($current_time - $last_updated_time) / 60 / 60;


if($time_difference > 1)
{
	
	$profile->getArmory($player_name, $all_players[0]['player_id']);

}

?>